package com.hhkj.payment.wechat.notification.common.processor;

import com.hhkj.payment.wechat.notification.common.parser.Parser;
import com.wechat.pay.java.core.notification.Notification;
import com.wechat.pay.java.service.payments.model.Transaction;

/**
 * TransactionSuccessProcessor
 *
 * @author HHKJ-SERVER-ZJ
 * @since 2023/11/22 20:37
 */
public interface TransactionSuccessProcessor extends Processor {

    /**
     * 处理对应数据
     *
     * @param notification 处理信息
     */
    default Object process(Notification notification, Parser parser) {
        Transaction transaction = parser.getDecryptObject(notification, Transaction.class);
        process(transaction);
        return transaction;
    }

    /**
     * 处理转账信息
     *
     * @param transaction 信息
     */
    void process(Transaction transaction);
}
